/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx.example;

import java.util.Random;

/**
 * <p>Project: javaseapp - Random1
 * <p>Powered by webrx On 2021-07-28 17:13:45
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 16
 */
public class Random2 {
    public static void main(String[] args) {
        String[] stus = new String[]{"李四", "赵六", "张三", "王五", "李强", "jack", "james gosling"};
        int size = stus.length;
        System.out.println(size);
        var rand = new Random();
        int index = rand.nextInt(stus.length);

        //index 5
        String info = String.format("有%d人学生，本次选中的学生是：%s", size, stus[index]);
        System.out.println(info);

    }
}
